package com.example.javamaday.leetcode;

import java.util.HashMap;

public class LeetCodeTest0136 {

    public static void main(String[] args) {

    }

    public int singleNumber(int[] nums) {
        HashMap<Integer, Integer> map = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if (map.get(nums[i]) == null) {
                map.put(nums[i], nums[i]);
            } else {
                map.remove(nums[i]);
            }
        }
        return (int) map.keySet().toArray()[0];
    }
}
